'use strict'

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
	const { router, controller } = app
	router.post('/admin/upload/img', controller.upload.uploadImg)
	router.get('/admin/captcha', controller.captcha.getCaptcha)
	router.post('/admin/login', controller.login.index)
	router.post('/admin/register', controller.register.index)
	app.put('/admin/auditArticle/:id', controller.article.updateAudit)
	app.put('/admin/updateHomePage/:id', controller.article.updateHomePage)
	app.resources('tag', '/admin/tags', controller.tag)
	app.resources('article', '/admin/articles', controller.article)
	app.resources('userInfo', '/admin/userInfo', controller.userInfo)
	app.resources('user', '/admin/user', controller.user)
	app.resources('menu', '/admin/menu', controller.menu)
	app.resources('menuRole', '/admin/menuRole', controller.menuRole)
	app.resources('audit', '/admin/audit', controller.audit)
	app.resources('apiArticle', '/api/articles', controller.apiArticle)
	app.resources('draft', '/admin/drafts', controller.draft)
	app.get('/admin/province', controller.region.province)
	app.get('/admin/city/:id', controller.region.city)
	app.get('/admin/area/:id', controller.region.area)

	app.get('/api/homePageArticles', controller.apiArticle.homePage)
	app.get('/api/search', controller.apiArticle.search)
}
